import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
// 按需导入组件
import Components from 'unplugin-vue-components/vite';
// vant组件
import {VantResolver} from 'unplugin-vue-components/resolvers';

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [
        vue(),
        Components({
            resolvers: [VantResolver()],
        }),
    ],

    resolve: {
        alias: {
            "@": path.resolve(__dirname, "src")
        }
    },

    // server: {
    //     proxy: {
    //         "/api": {
    //             // 要替换的服务器地址,将/api替换为服务器地址
    //             target: "http://localhost:3000", // 是否开启代理
    //             changeOrigin: true, // path为输入地址,将输入地址中,多余的/api(因为是自己加的,非访问对象的)替换为空字符串
    //             rewrite: (path) => path.replace(/^\/api/, ""),
    //         }
    //     }
    // }
})
